package com.ac.core.dm;

import java.io.Serializable;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright JieRuanShiJi 2004</p>
 * <p>Company: JieRuanShiJi</p>
 * @author <a href="mailto:lianzs@tom.com">Lianzs</a>
 * @version 1.0
 */

public class Column implements Serializable {
	private String colName;
	private String proName;

	public Column() {

	}

	public Column(String colName) {
		this.colName = colName;
		this.proName = fieldToName(colName);
	}

	public String getColName() {
		return colName;
	}

	public void setColName(String colName) {
		this.colName = colName;
	}

	public String getProName() {
		return proName;
	}

	public void setProName(String proName) {
		this.proName = proName;
	}

	private static String fieldToName(String str) {
		String strTemp = str.toLowerCase();
		int iPos = strTemp.indexOf("_");
		while (iPos > 0) {
			strTemp = strTemp.substring(0, iPos)
					+ strTemp.substring(iPos + 1, iPos + 2).toUpperCase()
					+ strTemp.substring(iPos + 2, strTemp.length());
			iPos = strTemp.indexOf("_");
		}
		return strTemp;
	}
}
